<template>
  <!-- 双击行弹窗 -->
  <div>
    <!-- :fetchapi="fetchApi"
      :params="fetchParams" -->
    <!-- :datakey="'IT_FJFL_DETAIL'" -->
    <FilterTable
      ref="table"
      :columns="columns"
      columnsRef="waxAttachmentDoubleFormA"
      :onColumnsChange="columns => (this.columns = columns)"
      :isSelectColumn="false"
      :isMemoryPagination="true"
      :dataSource="dataSource"
    >
    </FilterTable>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right'
      }"
    >
      <el-button @click="closeDialog">关闭</el-button>
    </div>
  </div>
</template>

<script>
import { getDoubleAttachment } from '@/api/part/report/attachmentQuery';
import { dictionary } from '@/utils/dictMixin';
export default {
  name: 'AttachDoubleClick',
  components: {},
  mixins: [dictionary],
  props: ['PERIOD', 'CODE'],
  data() {
    return {
      fetchParams: { xhrAbort: true },
      fetchApi: getDoubleAttachment,
      columns: this.createTableColumns(),
      dataSource: []
    };
  },
  created() {
    this.search();
  },
  methods: {
    // 初始化查询
    async search() {
      // console.log(1121, this.PERIOD);

      let res = await getDoubleAttachment({ I_PERIOD2: this.PERIOD, I_PERIOD1: this.PERIOD });
      if (res.resultCode == 200) {
        this.dataSource = res.data.IT_FJFL_DETAIL;

        if (res.data.RETURN.find(item => item.TYPE == 'E') != null) {
          return this.$notify.error({ title: '提示信息', message: '没有符合条件的数据' });
        }
        //  return this.$notify.success({title:'提示信息',messgae:'没有符合条件的数据'})
      }
    },
    // 关闭操作
    closeDialog() {
      this.$emit('close');
    },
    createTableColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '配件描述',
          dataIndex: 'MAKTX',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '配件号',
          dataIndex: 'MATNR',
          sorter: true,
          filter: true,
          filterType: 'input'
        }
      ];
    }
  }
};
</script>

<style scoped></style>
